<?php
/**
 * Created by PhpStorm.
 * User: yuanjie
 * Date: 2017/5/5
 * Time: 下午6:05
 */
class PosPayController extends BaseController
{
    /*
     * 退单
     * http://pay.yangche1hao.com/pos/pay/refund
     * */
    public function refundOrder(){
        $device_en = '351952ac';
        $cashier_trade_no = '10001979132017052700000001';

        $response = Pos::refundOrder($device_en,$cashier_trade_no);

        Log::info("info", array("system" => "pos" ,"event" => "prepareOrder", 'input' =>Input::all() ,"output" => $response));
        return json_encode($response);
    }

    /*
     * 通知
     * http://pay.yangche1hao.com/pos/pay/notify
     * */
    public function notifyOrder(){
        $response = Pos::notifyOrder(Input::all());

        Log::info("info", array("system" => "pos" ,"event" => "notifyOrder", 'input' =>Input::all() ,"output" => $response));
        return json_encode($response);
    }

    /*
     * 下单
     * http://pay.yangche1hao.com/pos/pay/prepare
     * */
    public function prepareOrder(){
        $device_en = '351952ac';
        $order_id = 'anhui'.time();
        $amount = 1000;
        $desc = 'testOrder';
        $attach = 'test';
        $response = Pos::prepareOrder($device_en,$order_id,$amount,$desc,$attach);

        Log::info("info", array("system" => "pos" ,"event" => "prepareOrder", 'input' =>Input::all() ,"output" => $response));
        return json_encode($response);
    }

    /*
     * 查单
     * http://pay.yangche1hao.com/pos/pay/status
     * */
    public function statusOrder(){
        $order_id = 'anhui1495855824';
        $response = Pos::statusOrder($order_id);

        Log::info("info", array("system" => "pos" ,"event" => "statusOrder", 'input' =>Input::all() ,"output" => $response));
        return json_encode($response);
    }
}